/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tpgen.manchester.w3org;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author shanki
 */
public class ManchesterPropability {
    private Map<Construct,Double> probs  = new HashMap<Construct, Double>();
    
    public ManchesterPropability() {        
        probs.put(Construct.factNot, 0.5);
        probs.put(Construct.descriptionOr, 0.2);
        probs.put(Construct.conjunctionAnd, 0.2);
        probs.put(Construct.primaryNot, 0.5);
        probs.put(Construct.restrictionObjectPrimary, 0.5);
        probs.put(Construct.restrictionDataPrimary, 0.5);
        probs.put(Construct.dataRangeOr, 0.2);
        probs.put(Construct.dataConjunctionAnd, 0.2);
        probs.put(Construct.dataPrimaryNot, 0.5);
        probs.put(Construct.listNext, 0.2);
        probs.put(Construct.twoListNext, 0.2);
        probs.put(Construct.list2Next, 0.2);
        probs.put(Construct.subPropertyChainNext, 0.2);
    }

    public void set(Construct construct, double prob) {
        probs.put(construct, prob);
    }
    
    public double get(Construct construct) {
        if (probs.containsKey(construct)) {
            return probs.get(construct);
        } else {
            return 1;
        }
    }

    public void zero(Iterable<Construct> constructs) {
        for (Construct construct : constructs) {
            zero(construct);
        }
    }

    private void zero(Construct construct) {
        probs.put(construct, 0.0);
    }
}